1. Technical Field of the Invention
The present invention relates to a magnetic data processing device, magnetic data processing method, and magnetic data processing program, and more particularly to a technology for correcting an offset of two-dimensional and three-dimensional magnetic sensors.
2. Description of the Related Art
A conventional magnetic sensor mounted on a moving body such as a mobile phone or a vehicle detects the direction of an Earth's magnetic field or geomagnetism. The magnetic sensor includes a set of magnetic sensor modules to detect scalar components of the magnetic field vector in mutually orthogonal directions. Magnetic data output from the magnetic sensor consists of a combination of outputs of the magnetic sensor modules, and thus the magnetic data is vector data that is a linear combination of mutually orthogonal unit vectors (fundamental vectors). The direction and magnitude of the magnetic data corresponds to the direction and magnitude of a magnetic field detected by the magnetic sensor. When specifying the direction or magnitude of an Earth's magnetic field based on outputs of the magnetic sensor, it is necessary to perform a process for correcting the outputs of the magnetic sensor in order to negate measurement errors caused by magnetization of the moving body or inherent temperature characteristics of the magnetic sensor. A control value of this correction process is referred to as an offset and a process for deriving the offset is referred to as calibration (see, for example, International Patent Publication No. 2004-003476). The offset is also vector data and defined as magnetic data output from the magnetic sensor when the intensity of external magnetic fields is zero. Such measurement errors are negated by subtracting the offset from the magnetic data output from the magnetic sensor. In a two-dimensional (2D) magnetic sensor, the offset corresponds to a position vector of the center of a circle on which a magnetic data set is distributed. However, practically, the distribution of a magnetic data set output from the 2D magnetic sensor does not form a perfect circle. The reasons are that outputs of magnetic sensor modules inherently have measurement errors following Gaussian distribution, a magnetic field measured by the 2D magnetic sensor varies during a period in which a data set of statistical population is stored to calculate the offset since in practice there is no completely uniform magnetic field, and calculation errors occur during AD conversion.
The 2D magnetic sensor outputs a data set of statistical population required to derive the offset while a moving body including the 2D magnetic sensor mounted thereon rotates such that the 2D magnetic sensor rotates about a rotation axis parallel to the direction perpendicular to orthogonal sensitive directions of its magnetic sensor modules. To move, in this manner, a moving body such as a mobile phone or a vehicle which is movable three-dimensionally, it is necessary for the user to intentionally operate the moving body so that it moves in such a manner. Accordingly, an offset derivation algorithm for a magnetic data processing device for deriving the offset of a 2D magnetic sensor is designed under the assumption that the user is explicitly informed of start of calibration and the user operates the moving body appropriately. However, it is troublesome and complicated for the user to perform the operation for calibration. In the conventional calibration method, it is determined, through binary decision, whether or not a reliable data set of statistical population has been stored, and, when the user has not correctly performed the operation for calibration, the calibration fails without storing a reliable data set of statistical population. This requires the user to repeat the operation for storing a reliable data set of statistical population.
A conventional 3-dimensional (3D) magnetic sensor mounted on a moving body such as a mobile phone or a vehicle detects the direction of an Earth's magnetic field. The 3D magnetic sensor generally includes 3 magnetic sensor modules to detect scalar components of the magnetic field vector in 3 orthogonal directions. Magnetic data output from the 3D magnetic sensor consists of a combination of outputs of the 3 magnetic sensor modules, and thus the magnetic data is 3D vector data that is a linear combination of mutually orthogonal unit vectors (fundamental vectors). The direction and magnitude of the magnetic data corresponds to the direction and magnitude of a magnetic field detected by the 3D magnetic sensor. When specifying the direction or magnitude of an Earth's magnetic field based on outputs of the 3D magnetic sensor, it is necessary to perform a process for correcting the outputs of the 3D magnetic sensor in order to negate measurement errors caused by magnetization of the moving body or inherent temperature characteristics of the magnetic sensor. A control value of this correction process is referred to as an offset. The offset is vector data indicating a magnetic field caused by the magnetization components of the moving body detected by the 3D magnetic sensor. Such measurement errors are negated by subtracting the offset from the magnetic data output from the 3D magnetic sensor. It is possible to calculate the offset by obtaining the center of a spherical surface on which a magnetic data set is distributed.
However, practically, the distribution of magnetic data does not form a perfect sphere. The reasons are that outputs of the 3D magnetic sensor inherently have measurement errors following Gaussian distribution, a magnetic field measured by the 3D magnetic sensor varies during a period in which magnetic data required to calculate the offset is stored since in practice there is no completely uniform magnetic field, and calculation errors occur until digital values are obtained from the outputs of the 3D magnetic sensor.
A conventional method for deriving a magnetic sensor offset stores a large number of magnetic data and derives the offset through a statistical process of the stored magnetic data. Thus, in the conventional method, a magnetic data set required to accurately update the offset is not stored unless the user intentionally changes the attitude or posture of the moving body, and a long time is required to update the offset after the need to update the offset occurs. Usually, magnetic data distributed only in two dimensions is stored since a significant three-dimensional change in the attitude of the magnetic sensor mounted on the vehicle is rare. Thus, it is undesirable to wait until a magnetic data set evenly distributed on a spherical surface is stored in order to accurately update the offset of the magnetic sensor mounted on the vehicle.
International Patent Publication No. 2005-061990 has disclosed an algorithm which can correct the offset even if the distribution of a magnetic data set is two-dimensional. However, it is not easy to implement a program according to the algorithm described in International Patent Publication No. 2005-061990 since it is complicated.